#include "Player.h"
#include "LuaScript.h"

Player::Player(void)
: health(100)
, cash(0)
{
	dir(0,0,1);

	radius = 2;

	dList = glGenLists(1);
	glNewList(dList, GL_COMPILE_AND_EXECUTE);
		glPushAttrib(GL_LIGHTING_BIT);
		glDisable(GL_LIGHTING);
		glutSolidSphere(radius,20,20);
		glPopAttrib();
	glEndList();
}

void Player::Update(float delta)
{
	if(health > 100) health = 100;
	else if(health < 0) health = 0;
}

void Player::Draw(void)
{
	float rColor = (float(health) / 100);
	glColor3f(1,rColor,rColor);
	glCallList(dList);
}